<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean" prefix="bean"%>
<%@ taglib uri="/WEB-INF/tld/struts-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-logic" prefix="logic"%>
<%@ taglib uri="/WEB-INF/tld/jstl/c" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/jstl/fn" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="ebb365,ebb365,ebb365">
	<meta http-equiv="description" content="ebb365">
	<title>经销商业会员列表</title>
	<link rel="stylesheet" type="text/css" href="/admin/css/css.css"></link>
<script type='text/javascript' src='/dwr/interface/CountryAreaSelect.js'></script>
<script type='text/javascript' src='/dwr/engine.js'></script>
<script type='text/javascript' src='/dwr/util.js'></script>

<script type="text/javascript">

		 function getCiytByProvId(provID){
		    CountryAreaSelect.getAllCitiesByProvinceId(provID,citySelectOptions);
		 }
		 
		 function citySelectOptions(cityList){
		      DWRUtil.removeAllOptions("cityId");
		      DWRUtil.addOptions("cityid", {'-2':'请选择'}); 
		      DWRUtil.addOptions("cityId", cityList); 
		 }
		 
		 function getProvSelected(selectObj){
		       for(var i = 0; i < selectObj.options.length; i++){
			       if (selectObj.options[i].selected){
			         var id = selectObj.options[i].value;
			          getCiytByProvId(id);
			       }
			   }
		 }
 
</script>

	<script language="JavaScript">
<!--//

		
		function selectAll(choice) {
		   if(document.forms['theForm1'].checkboxparam.length!=null)
		   {
			   for (var i=0;i<document.forms['theForm1'].checkboxparam.length;i++) 
			   {
					var e=document.forms['theForm1'].checkboxparam[i];
					if(choice==1)e.checked=true;
					if(choice==2)e.checked=(e.checked?false:true);
					if(choice==3)e.checked=false;
				}
		   }
	   //单个的处理
	   else
	   {
	     var e=document.forms['theForm1'].checkboxparam;
	     if(choice==1)e.checked=true;
				if(choice==2)e.checked=(e.checked?false:true);
				if(choice==3)e.checked=false;
	     
	   }
	}

	function  checkboxIsSelected(){

	   var flag = 0;
	   if(document.forms['theForm1'].checkboxparam.length!=null)
	   {
	        for (var i=0;i<document.forms['theForm1'].checkboxparam.length;i++) 
			   {
			        var e=document.forms['theForm1'].checkboxparam[i];
			        if(e.checked){
						flag = 1;
					}
			   }
			   if(flag==1)
			   {
			     return true;
			   }else{
			        window.alert('至少选择一项!');
			        return false;
			   }
	   }
   
	   //只选择了一项
	   else if(document.forms['theForm1'].checkboxparam!=null)
	   {
	       var e=document.forms['theForm1'].checkboxparam;
	        if(e.checked)
	        {
						flag = 1;
		    }
		    
		      if(flag==1)
			   {
			      return true
	           }else{
			        window.alert('至少选择一项!');
			        return false;
			   }
	   }
   		        window.alert('至少选择一项!');
		        return false;
	}
	//-->
	</script>

<script type="text/javascript">

function  checkboxIsSelected2(dovalue){

   var str = new Array();
   var j = 0;
   var flag = 0;
  // alert('length:'+document.forms['theForm1'].checkboxparam.length);
   if(document.forms['theForm1'].checkboxparam!=null && document.forms['theForm1'].checkboxparam.length!=null)
   {
        for (var i=0;i<document.forms['theForm1'].checkboxparam.length;i++) 
		   {
		        var e=document.forms['theForm1'].checkboxparam[i];
		        if(e.checked){
					str[j]=e.value;
					j++;
					flag = 1;
				}
		   }
		   if(flag==1)
		   {
		   	  var linkStr = document.getElementById('linkStrcheckandcommend').value;
		      var toPageLink1="/admin/dealer/dealers_list.do?method=updateisCommend&checkboxparam=";
		      
		      var toPageLink2="/admin/dealer/dealers_list.do?method=updateIfCheck&checkboxparam=";
		      
		      var toPageLink3="/admin/dealer/dealers_list.do?method=updateShopCommend&checkboxparam=";
		      var toPageLink4="/admin/dealer/dealers_list.do?method=updateAreaSiteCommend&checkboxparam=";
		   
		        //推荐/取消
		        if(dovalue==1)
		        window.location=encodeURI(toPageLink1+ str+linkStr);
		        //审核/取消
		        if(dovalue==2)
		        window.location =encodeURI(toPageLink2+ str+linkStr);
		        //店铺推荐/取消
		        if(dovalue==3)
		        window.location =encodeURI(toPageLink3+ str+linkStr);
		        //分站推荐/取消
		        if(dovalue==4)
		        window.location =encodeURI(toPageLink4+ str+linkStr);
		   }else{
		        window.alert('至少选择一项!');
		        return false;
		   }
   }
   
   //只选择了一项
   else if(document.forms['theForm1'].checkboxparam!=null)
   {
       var e=document.forms['theForm1'].checkboxparam;
        if(e.checked)
        {
					str[j]=e.value;
					flag = 1;
	    }
	    
	      if(flag==1)
		   {
		   	var linkStr = document.getElementById('linkStrcheckandcommend').value;
		      var toPageLink1="/admin/dealer/dealers_list.do?method=updateisCommend&checkboxparam=";
		      
		      var toPageLink2="/admin/dealer/dealers_list.do?method=updateIfCheck&checkboxparam=";
		      
		       var toPageLink3="/admin/dealer/dealers_list.do?method=updateShopCommend&checkboxparam=";
		       
		       var toPageLink4="/admin/dealer/dealers_list.do?method=updateAreaSiteCommend&checkboxparam=";
		      
		        //推荐
		        if(dovalue==1)
		        window.location=encodeURI(toPageLink1+ str+linkStr);
		        //审核
		        if(dovalue==2)
		        window.location =encodeURI(toPageLink2+ str+linkStr);
		        
		        //店铺推荐/取消
		        if(dovalue==3)
		        window.location =encodeURI(toPageLink3+ str+linkStr);
		        
		        //分站推荐/取消
		        if(dovalue==4)
		        window.location =encodeURI(toPageLink4+ str+linkStr);

           }else{
		        window.alert('至少选择一项!');
		        return false;
		   }
	   }
	}

			function toPage(){
				var linkStr = document.getElementById('linkStr').value;
				var page = document.getElementById('toPage').value;
				if(page != ''){
					if(isNaN(page)){
						alert('请输入数字');
						document.getElementById('toPage').value = '';
						return false;
					}else{
						var linkStr = document.getElementById('linkStr').value;
						var toPageLink="/admin/dealer/dealers_list.do?method=list"+linkStr+"&page="+page;
						window.location=encodeURI(toPageLink);
						return true;
					}
				}else{
					return false;
				}
			}

</script>
</head>
<body>

	 <html:form action="/admin/dealer/dealers_list.do?method=searchQiyejibiaoPagination">
    	<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td>注册帐号：<html:text property="qyjbUserName" value="${qyjbUserName}" size="6"></html:text>
					经销商名称：<html:text property="qiyename" value="${qyjb_cpName}" size="6"></html:text>
					　推荐
					<html:select property="isCommend" size="1">
						<option value="-1">请选择</option>
						<option value="0" <c:if test="${isCommend==0}">selected</c:if>>未推荐</option>
						<option value="1" <c:if test="${isCommend==1}">selected</c:if>>已推荐</option>
					</html:select>
					　审核
					<html:select property="ifCheck" size="1">
						<option value="-1">请选择</option>
						<option value="0" <c:if test="${ifCheck==0}">selected</c:if>>未通过</option>
						<option value="1" <c:if test="${ifCheck==1}">selected</c:if>>已通过</option>
					</html:select>
					<br>省市
					<html:select property="provId" size="1" onchange="getProvSelected(this);">
						<option value="-1">请选择</option>
						<logic:present name="provList">
							<logic:iterate id="list" name="provList">
								<option value="${list.provId}" <c:if test="${prov.provId==list.provId}">selected</c:if>>${list.prov}</option>
							</logic:iterate>
						</logic:present>
					</html:select>
					<html:select property="cityId" size="1">
						<option value="-1">请选择</option>
						<logic:present name="cityList">
							<logic:iterate id="list" name="cityList">
								<option value="${list.cityId}" <c:if test="${city.cityId==list.cityId}">selected</c:if>>${list.city}</option>
							</logic:iterate>
						</logic:present>
					</html:select>
					　类型
					<html:select property="hyType" size="1">
						<option value="-1">请选择</option>
						<option value="1" <c:if test="${hyType==1}">selected</c:if>>招商通</option>
						<option value="2" <c:if test="${hyType==2}">selected</c:if>>网购通</option>
					</html:select>
					<html:submit value="给我搜" />
					<a href="/EBBQyRegAction.do?action=toReg" target="_self">注册新用户</a>
				</td>
			</tr>
    	</table>
    </html:form>
	

	
	<form action="dealers_list.do?method=deleteQiyeinfo" name="theForm1"
		method="post">
		<c:set var="linkStr" value="&qyjb_cpName=${qyjb_cpName}&isCommend=${isCommend}&ifCheck=${ifCheck}&hyType=${hyType}&provId=${provId}&cityId=${cityId}"></c:set>
		<c:set var="link" value="/admin/dealer/dealers_list.do?method=list${linkStr}"></c:set>
		<input type="hidden" id="linkStr" value="${linkStr}">
		
		
		<c:set var="linkStrcheckandcommend" value="&bkpage=${page}&bkqyjb_cpName=${qyjb_cpName}&bkisCommend=${isCommend}&bkifCheck=${ifCheck}&bkhyType=${hyType}&bkprovId=${provId}&bkcityId=${cityId}"></c:set>
		<input type="hidden" id="linkStrcheckandcommend" value="${linkStrcheckandcommend}">
		
		<table width="100%" border="1" align="center" cellpadding="0"
			cellspacing="0">
			<tr align="center">
				<td>※</td>
				<td>基表ID</td>
				<td>注册帐号</td>
				<td>经销商名称</td>
				<td>经销商类别</td>
				<td>招商/网购通</td>
				<td>加入时间</td>
				<td title="企业推荐">推荐</td>
				<td title="店铺推荐">店铺</td>
				<td title="分站推荐">分站</td>
				<td>审核</td>
				<td>编辑</td>
				<td>密码</td>
				<td>等级</td>
			</tr>
			<tbody>
				<logic:present name="qyjbList">
					<logic:iterate id="list" name="qyjbList">
						<tr align="center">
							<td>
								<input type="checkbox" name="checkboxparam"
									value="${list.qyid}">
							</td>
							<td title="${list.qyid}">
								${list.qyid}
							</td>
							<td>
								${list.qyname}
							</td>
							<td align="left">
								<a href="dealers_list.do?method=loadQiyeinfo&id=${list.qyid}" title="${list.cpName}">
								${fn:substring(list.cpName,0,12)}</a>
							</td>
							<td>
								<c:choose>
									<c:when test="${list.cpFl==0}">整车企业</c:when>
									<c:when test="${list.cpFl==1}">配件企业</c:when>
									<c:when test="${list.cpFl==2}">经销商</c:when>
									<c:when test="${list.cpFl==3}">商业市场</c:when>
									<c:when test="${list.cpFl==4}">其他</c:when>
									<c:when test="${list.cpFl==5}">行业机构</c:when>
									<c:when test="${list.cpFl==6}">外贸单位</c:when>
									<c:otherwise>&nbsp;</c:otherwise>
								</c:choose>
							</td>
							<td>
								<c:if test="${list.attractBusinessManType==1}">招商</c:if>/<c:if test="${list.saleBusinessManType==1}">网购</c:if>
							</td>
							<td>
								<bean:write name="list" property="regtime" format="yyyy年MM月dd日" />
							</td>
							
							<td>
								<c:choose>
									<c:when test="${list.isCommend==1}">★</c:when>
									<c:otherwise>☆</c:otherwise>
								</c:choose>
							</td>
							<td>
								<c:choose>
									<c:when test="${list.shopCommend==1}">★</c:when>
									<c:otherwise>☆</c:otherwise>
								</c:choose>
							</td>
							
							<td>
								<c:choose>
									<c:when test="${list.areaSiteCommend==1}">★</c:when>
									<c:otherwise>☆</c:otherwise>
								</c:choose>
							</td>
							<td>
								<c:choose>
									<c:when test="${list.cpIfCheck==1}">★</c:when>
									<c:otherwise>☆</c:otherwise>
								</c:choose>
							</td>
							
						
							
							
							<td>
								<a
									href="javascript:window.location=encodeURI('dealers_list.do?method=editQiyeinfo&id=${list.qyid}&bkpage=${page}${linkStr}'); void 0;">
									<img src="/admin/images/edititem.gif" style="cursor:hand;"></a>
							</td>
							<td>
								<a
									href="javascript:window.location=encodeURI('dealers_list.do?method=editQiyeinfoPwd&id=${list.qyid}&bkpage=${page}${linkStr}'); void 0;">
									<img src="/admin/images/edititem.gif" style="cursor:hand;"></a>
							</td>
							<td>
								<a 
								href="javascript:window.location=encodeURI('dealers_list.do?method=editQiyeinfoGrade&id=${list.qyid}&bkpage=${page}${linkStr}'); void 0;">
								<img src="/admin/images/edititem.gif" style="cursor:hand;"></a>
							</td>
						</tr>
					</logic:iterate>
				</logic:present>
			</tbody>
		</table>
		<table width="100%" border="1" align="center" cellpadding="0"
			cellspacing="0">
			<tr>
				<td height="4">&nbsp;</td>
			</tr>
				<logic:present name="qyjbList">
				<tr>
					<td>
						<html:button onclick="selectAll(1);" property="button" value="全 选" />
						<html:button onclick="selectAll(2);" property="button" value="反 选" />
						<html:button onclick="selectAll(3);" property="button" value="不 选" />
						<input type="submit" value="选择删除" name="submit" onclick="return checkboxIsSelected();">
				<html:button onclick="javascript:checkboxIsSelected2(1);void 0" property="button" value="推荐/取消推荐"/>
				<html:button onclick="javascript:checkboxIsSelected2(3);void 0" property="button" value="设置/取消店铺推荐"/>
				<html:button onclick="javascript:checkboxIsSelected2(2);void 0" property="button" value="审核/取消审核"/>
				<html:button onclick="javascript:checkboxIsSelected2(4);void 0" property="button" value="分站推荐/取消"/>
					<font color="red">注：★为是，☆为否 </font>
					</td>
				</tr>
				</logic:present>
		</table>
	</form>

	<div>
		
		共 <b>${recordNum}</b> 条记录 共 ${allPage} 页，当前<font color="red"> ${curPage}</font>/${allPage}|&nbsp;
		<input size="4" value="" id="toPage" maxlength="4"/>
		<img src="/admin/images/ck.gif" style="cursor:hand;" onclick="return toPage();"><br>
		<c:if test="${curPage>1}"><a href="${link}&page=${1}">首页</a></c:if>
		<c:if test="${curPage>1}">
		   <a href="${link}&page=${backPage}">上一页</a>
		</c:if>
		<%--  页码循环 --%>
		<c:if test="${(curPage>=1)&&(curPage<=7)&&(allPage<12) && recordNum > 20}">
		<c:forEach begin="${1}" end="${allPage}" var="page" step="1" varStatus="pageCount">
			<a href="${link}&page=${pageCount.index}">
				[<c:if test="${curPage==page}">
					<font color="red" class="one">
						<c:out value="${pageCount.index}"></c:out> 
					</font>
				</c:if>
				<c:if test="${curPage!=page}">
						<c:out value="${pageCount.index}"></c:out>
				</c:if>]
			</a>
		</c:forEach>
		</c:if>
		<c:if test="${(curPage>=1)&&(curPage<=7)&&(allPage>12)}">
		<c:forEach begin="${1}" end="${12}" var="page" step="1" varStatus="pageCount">
			<a href="${link}&page=${pageCount.index}">
				[<c:if test="${curPage==page}">
					<font color="red" class="one">
						<c:out value="${pageCount.index}"></c:out> 
					</font>
				</c:if>
				<c:if test="${curPage!=page}">
						<c:out value="${pageCount.index}"></c:out>
				</c:if>]
			</a>
		</c:forEach>
		</c:if>
		<c:if test="${curPage>7&&(allPage>(curPage+5))}">
		<c:forEach begin="${(curPage-4)}" end="${(curPage+5)}" var="page" step="1" varStatus="pageCount">
			<a href="${link}&page=${pageCount.index}">
				[<c:if test="${curPage==page}">
					<font color="red" class="one">
						<c:out value="${pageCount.index}"></c:out> 
					</font>
				</c:if>
				<c:if test="${curPage!=page}">
						<c:out value="${pageCount.index}"></c:out>
				</c:if>]
			</a>
		</c:forEach>
		</c:if>
		<c:if test="${curPage>7&&(allPage<=(curPage+5))}">
		<c:forEach begin="${(curPage-4)}" end="${allPage}" var="page" step="1" varStatus="pageCount">
			<a href="${link}&page=${pageCount.index}">
				[<c:if test="${curPage==page}">
					<font color="red" class="one">
						<c:out value="${pageCount.index}"></c:out> 
					</font>
				</c:if>
				<c:if test="${curPage!=page}">
						<c:out value="${pageCount.index}"></c:out>
				</c:if>]
			</a>
		</c:forEach>
		</c:if>

				<c:if test="${curPage<allPage}">
					<a href="${link}&page=${nextPage}">下一页</a>
				</c:if>
            <c:if test="${(allPage>1)&&(curPage<allPage)}">
			<a href="${link}&page=${allPage}">尾 页</a></c:if>
				
	</div>
	<div><br>	</div>
	<logic:present name="msg">
		<bean:write name="msg" filter="false" />
	</logic:present>
	<logic:present name="edit_successfully">
		<bean:write name="edit_successfully" filter="false" />
	</logic:present>
	
</body>
</html:html>
